package com.caogt.programmer.qm.question.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.caogt.programmer.qm.question.entity.QuestionAnswer;
import com.caogt.programmer.qm.question.mapper.QuestionAnswerMapper;
import com.caogt.programmer.qm.question.service.IQuestionAnswerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author caogt
 * @since 2020-01-05
 */
@Service
public class QuestionAnswerServiceImpl extends ServiceImpl<QuestionAnswerMapper, QuestionAnswer> implements IQuestionAnswerService {

    @Override
    public void batchSave(List<QuestionAnswer> answerList) {
        super.saveBatch(answerList);
    }

    @Override
    public void deleteByQuestionId(Long questionId) {
        QueryWrapper<QuestionAnswer> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("question_id",questionId);
        super.remove(queryWrapper);
    }

    @Override
    public List<QuestionAnswer> getByQuestionId(Long questionId) {
        QueryWrapper<QuestionAnswer> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("question_id",questionId);
        return super.list(queryWrapper);
    }
}
